package top.shen33.yang.controller;

import java.util.Date;
import java.util.List;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.shen33.yang.base.util.Underline2Camel;
import top.shen33.yang.model.entity.MetaColumns;
import top.shen33.yang.model.vo.BodyData;

/**
 * Created by Administrator on 2018-08-23.
 */

@Controller
@RequestMapping("/code")
//@Api(value = "html页面")
public class CodeController {


    @ApiOperation(httpMethod = "POST",value = "根据模板生成html页面代码",notes = "生成html")
    @RequestMapping("tp")
    public Object helloFtl(Map<String,Object> map,String tableName, @RequestBody BodyData bodyData) {

        List<MetaColumns> selectColumnList = bodyData.getSelectColumnList();
        List<MetaColumns> gridColumnList = bodyData.getGridColumnList();
        List<MetaColumns> formColumnList = bodyData.getFormColumnList();

        map.put("selectColumnList",selectColumnList);
        map.put("gridColumnList",gridColumnList);
        map.put("formColumnList",formColumnList);
        map.put("hello","Hello FreeMarker");

//        Short sex = 2;
//        Date sysDate= new Date();
//        map.put("sex",sex);
//        map.put("sysDate",sysDate);
        map.put("tableName", Underline2Camel.underline2Camel(tableName,true));
        return "/tp";
    }
}
